package io.yuncheng.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import io.yuncheng.modules.sys.entity.SubAppLogEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.yuncheng.modules.sys.service.SubAppLogService;
import io.yuncheng.common.utils.PageUtils;
import io.yuncheng.common.utils.R;



/**
 * 系统日志
 *
 * @author jared
 * @email 15721509625@163.com
 * @date 2020-11-26 20:39:57
 */
@RestController
@RequestMapping("sys/subapplog")
public class SubAppLogController {
    @Autowired
    private SubAppLogService subAppLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:subapplog:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = subAppLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:subapplog:info")
    public R info(@PathVariable("id") Long id){
		SubAppLogEntity subAppLog = subAppLogService.getById(id);

        return R.ok().put("subAppLog", subAppLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:subapplog:save")
    public R save(@RequestBody SubAppLogEntity subAppLog){
		subAppLogService.save(subAppLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:subapplog:update")
    public R update(@RequestBody SubAppLogEntity subAppLog){
		subAppLogService.updateById(subAppLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:subapplog:delete")
    public R delete(@RequestBody Long[] ids){
		subAppLogService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
